//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension IoTJobsDataPlane {
    // MARK: Enums

    public enum JobExecutionStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case canceled = "CANCELED"
        case failed = "FAILED"
        case inProgress = "IN_PROGRESS"
        case queued = "QUEUED"
        case rejected = "REJECTED"
        case removed = "REMOVED"
        case succeeded = "SUCCEEDED"
        case timedOut = "TIMED_OUT"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct CommandParameterValue: AWSEncodableShape {
        /// An attribute of type Boolean. For example:  "BOOL": true
        public let b: Bool?
        /// An attribute of type Binary.
        public let bin: AWSBase64Data?
        /// An attribute of type Double (Sixty-Four Bits).
        public let d: Double?
        /// An attribute of type Integer (Thirty-Two Bits).
        public let i: Int?
        /// An attribute of type Long.
        public let l: Int64?
        /// An attribute of type String. For example:  "S": "Hello"
        public let s: String?
        /// An attribute of type Unsigned Long.
        public let ul: String?

        @inlinable
        public init(b: Bool? = nil, bin: AWSBase64Data? = nil, d: Double? = nil, i: Int? = nil, l: Int64? = nil, s: String? = nil, ul: String? = nil) {
            self.b = b
            self.bin = bin
            self.d = d
            self.i = i
            self.l = l
            self.s = s
            self.ul = ul
        }

        public func validate(name: String) throws {
            try self.validate(self.bin, name: "bin", parent: name, min: 1)
            try self.validate(self.s, name: "s", parent: name, min: 1)
            try self.validate(self.ul, name: "ul", parent: name, max: 20)
            try self.validate(self.ul, name: "ul", parent: name, min: 1)
            try self.validate(self.ul, name: "ul", parent: name, pattern: "^[0-9]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case b = "B"
            case bin = "BIN"
            case d = "D"
            case i = "I"
            case l = "L"
            case s = "S"
            case ul = "UL"
        }
    }

    public struct ConflictException: AWSErrorShape {
        public let message: String?
        /// A conflict occurred while performing the API request on the resource ID.
        public let resourceId: String?

        @inlinable
        public init(message: String? = nil, resourceId: String? = nil) {
            self.message = message
            self.resourceId = resourceId
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
            case resourceId = "resourceId"
        }
    }

    public struct DescribeJobExecutionRequest: AWSEncodableShape {
        /// Optional. A number that identifies a particular job execution on a particular device. If not specified, the latest job execution is returned.
        public let executionNumber: Int64?
        /// Optional. Unless set to false, the response contains the job document. The default is true.
        public let includeJobDocument: Bool?
        /// The unique identifier assigned to this job when it was created.
        public let jobId: String
        /// The thing name associated with the device the job execution is running on.
        public let thingName: String

        @inlinable
        public init(executionNumber: Int64? = nil, includeJobDocument: Bool? = nil, jobId: String, thingName: String) {
            self.executionNumber = executionNumber
            self.includeJobDocument = includeJobDocument
            self.jobId = jobId
            self.thingName = thingName
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodeQuery(self.executionNumber, key: "executionNumber")
            request.encodeQuery(self.includeJobDocument, key: "includeJobDocument")
            request.encodePath(self.jobId, key: "jobId")
            request.encodePath(self.thingName, key: "thingName")
        }

        public func validate(name: String) throws {
            try self.validate(self.jobId, name: "jobId", parent: name, pattern: "^[a-zA-Z0-9_-]+|^\\$next$")
            try self.validate(self.thingName, name: "thingName", parent: name, max: 128)
            try self.validate(self.thingName, name: "thingName", parent: name, min: 1)
            try self.validate(self.thingName, name: "thingName", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeJobExecutionResponse: AWSDecodableShape {
        /// Contains data about a job execution.
        public let execution: JobExecution?

        @inlinable
        public init(execution: JobExecution? = nil) {
            self.execution = execution
        }

        private enum CodingKeys: String, CodingKey {
            case execution = "execution"
        }
    }

    public struct GetPendingJobExecutionsRequest: AWSEncodableShape {
        /// The name of the thing that is executing the job.
        public let thingName: String

        @inlinable
        public init(thingName: String) {
            self.thingName = thingName
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.thingName, key: "thingName")
        }

        public func validate(name: String) throws {
            try self.validate(self.thingName, name: "thingName", parent: name, max: 128)
            try self.validate(self.thingName, name: "thingName", parent: name, min: 1)
            try self.validate(self.thingName, name: "thingName", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetPendingJobExecutionsResponse: AWSDecodableShape {
        /// A list of JobExecutionSummary objects with status IN_PROGRESS.
        public let inProgressJobs: [JobExecutionSummary]?
        /// A list of JobExecutionSummary objects with status QUEUED.
        public let queuedJobs: [JobExecutionSummary]?

        @inlinable
        public init(inProgressJobs: [JobExecutionSummary]? = nil, queuedJobs: [JobExecutionSummary]? = nil) {
            self.inProgressJobs = inProgressJobs
            self.queuedJobs = queuedJobs
        }

        private enum CodingKeys: String, CodingKey {
            case inProgressJobs = "inProgressJobs"
            case queuedJobs = "queuedJobs"
        }
    }

    public struct JobExecution: AWSDecodableShape {
        /// The estimated number of seconds that remain before the job execution status will be changed to TIMED_OUT. The actual job execution timeout can occur up to 60 seconds later than the estimated duration.
        public let approximateSecondsBeforeTimedOut: Int64?
        /// A number that identifies a particular job execution on a particular device. It can be used later in commands that return or update job execution information.
        public let executionNumber: Int64?
        /// The content of the job document.
        public let jobDocument: String?
        /// The unique identifier you assigned to this job when it was created.
        public let jobId: String?
        /// The time, in seconds since the epoch, when the job execution was last updated.
        public let lastUpdatedAt: Int64?
        /// The time, in seconds since the epoch, when the job execution was enqueued.
        public let queuedAt: Int64?
        /// The time, in seconds since the epoch, when the job execution was started.
        public let startedAt: Int64?
        /// The status of the job execution. Can be one of: "QUEUED", "IN_PROGRESS", "FAILED", "SUCCESS", "CANCELED", "TIMED_OUT", "REJECTED", or "REMOVED".
        public let status: JobExecutionStatus?
        /// A collection of name/value pairs that describe the status of the job execution. The maximum length of the value in the name/value pair is 1,024 characters.
        public let statusDetails: [String: String]?
        /// The name of the thing that is executing the job.
        public let thingName: String?
        /// The version of the job execution. Job execution versions are incremented each time they are updated by a device.
        public let versionNumber: Int64?

        @inlinable
        public init(approximateSecondsBeforeTimedOut: Int64? = nil, executionNumber: Int64? = nil, jobDocument: String? = nil, jobId: String? = nil, lastUpdatedAt: Int64? = nil, queuedAt: Int64? = nil, startedAt: Int64? = nil, status: JobExecutionStatus? = nil, statusDetails: [String: String]? = nil, thingName: String? = nil, versionNumber: Int64? = nil) {
            self.approximateSecondsBeforeTimedOut = approximateSecondsBeforeTimedOut
            self.executionNumber = executionNumber
            self.jobDocument = jobDocument
            self.jobId = jobId
            self.lastUpdatedAt = lastUpdatedAt
            self.queuedAt = queuedAt
            self.startedAt = startedAt
            self.status = status
            self.statusDetails = statusDetails
            self.thingName = thingName
            self.versionNumber = versionNumber
        }

        private enum CodingKeys: String, CodingKey {
            case approximateSecondsBeforeTimedOut = "approximateSecondsBeforeTimedOut"
            case executionNumber = "executionNumber"
            case jobDocument = "jobDocument"
            case jobId = "jobId"
            case lastUpdatedAt = "lastUpdatedAt"
            case queuedAt = "queuedAt"
            case startedAt = "startedAt"
            case status = "status"
            case statusDetails = "statusDetails"
            case thingName = "thingName"
            case versionNumber = "versionNumber"
        }
    }

    public struct JobExecutionState: AWSDecodableShape {
        /// The status of the job execution. Can be one of: "QUEUED", "IN_PROGRESS", "FAILED", "SUCCESS", "CANCELED", "TIMED_OUT", "REJECTED", or "REMOVED".
        public let status: JobExecutionStatus?
        /// A collection of name/value pairs that describe the status of the job execution. The maximum length of the value in the name/value pair is 1,024 characters.
        public let statusDetails: [String: String]?
        /// The version of the job execution. Job execution versions are incremented each time they are updated by a device.
        public let versionNumber: Int64?

        @inlinable
        public init(status: JobExecutionStatus? = nil, statusDetails: [String: String]? = nil, versionNumber: Int64? = nil) {
            self.status = status
            self.statusDetails = statusDetails
            self.versionNumber = versionNumber
        }

        private enum CodingKeys: String, CodingKey {
            case status = "status"
            case statusDetails = "statusDetails"
            case versionNumber = "versionNumber"
        }
    }

    public struct JobExecutionSummary: AWSDecodableShape {
        /// A number that identifies a particular job execution on a particular device.
        public let executionNumber: Int64?
        /// The unique identifier you assigned to this job when it was created.
        public let jobId: String?
        /// The time, in seconds since the epoch, when the job execution was last updated.
        public let lastUpdatedAt: Int64?
        /// The time, in seconds since the epoch, when the job execution was enqueued.
        public let queuedAt: Int64?
        /// The time, in seconds since the epoch, when the job execution started.
        public let startedAt: Int64?
        /// The version of the job execution. Job execution versions are incremented each time IoT Jobs receives an update from a device.
        public let versionNumber: Int64?

        @inlinable
        public init(executionNumber: Int64? = nil, jobId: String? = nil, lastUpdatedAt: Int64? = nil, queuedAt: Int64? = nil, startedAt: Int64? = nil, versionNumber: Int64? = nil) {
            self.executionNumber = executionNumber
            self.jobId = jobId
            self.lastUpdatedAt = lastUpdatedAt
            self.queuedAt = queuedAt
            self.startedAt = startedAt
            self.versionNumber = versionNumber
        }

        private enum CodingKeys: String, CodingKey {
            case executionNumber = "executionNumber"
            case jobId = "jobId"
            case lastUpdatedAt = "lastUpdatedAt"
            case queuedAt = "queuedAt"
            case startedAt = "startedAt"
            case versionNumber = "versionNumber"
        }
    }

    public struct StartCommandExecutionRequest: AWSEncodableShape {
        /// The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.
        public let clientToken: String?
        /// The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:::command/
        public let commandArn: String
        /// Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to TIMED_OUT.
        public let executionTimeoutSeconds: Int64?
        /// A list of parameters that are required by the StartCommandExecution API when performing the command on a device.
        public let parameters: [String: CommandParameterValue]?
        /// The Amazon Resource Number (ARN) of the device where the command execution is occurring.
        public let targetArn: String

        @inlinable
        public init(clientToken: String? = StartCommandExecutionRequest.idempotencyToken(), commandArn: String, executionTimeoutSeconds: Int64? = nil, parameters: [String: CommandParameterValue]? = nil, targetArn: String) {
            self.clientToken = clientToken
            self.commandArn = commandArn
            self.executionTimeoutSeconds = executionTimeoutSeconds
            self.parameters = parameters
            self.targetArn = targetArn
        }

        public func validate(name: String) throws {
            try self.validate(self.clientToken, name: "clientToken", parent: name, max: 64)
            try self.validate(self.clientToken, name: "clientToken", parent: name, min: 1)
            try self.validate(self.clientToken, name: "clientToken", parent: name, pattern: "^[\\x21-\\x7E]+$")
            try self.validate(self.executionTimeoutSeconds, name: "executionTimeoutSeconds", parent: name, min: 1)
            try self.parameters?.forEach {
                try validate($0.key, name: "parameters.key", parent: name, max: 192)
                try validate($0.key, name: "parameters.key", parent: name, min: 1)
                try validate($0.key, name: "parameters.key", parent: name, pattern: "^[.$a-zA-Z0-9_-]+$")
                try $0.value.validate(name: "\(name).parameters[\"\($0.key)\"]")
            }
            try self.validate(self.parameters, name: "parameters", parent: name, min: 1)
            try self.validate(self.targetArn, name: "targetArn", parent: name, max: 2048)
        }

        private enum CodingKeys: String, CodingKey {
            case clientToken = "clientToken"
            case commandArn = "commandArn"
            case executionTimeoutSeconds = "executionTimeoutSeconds"
            case parameters = "parameters"
            case targetArn = "targetArn"
        }
    }

    public struct StartCommandExecutionResponse: AWSDecodableShape {
        /// A unique identifier for the command execution.
        public let executionId: String?

        @inlinable
        public init(executionId: String? = nil) {
            self.executionId = executionId
        }

        private enum CodingKeys: String, CodingKey {
            case executionId = "executionId"
        }
    }

    public struct StartNextPendingJobExecutionRequest: AWSEncodableShape {
        /// A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. The maximum length of the value in the name/value pair is 1,024 characters.
        public let statusDetails: [String: String]?
        /// Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by calling UpdateJobExecution, setting the status to IN_PROGRESS, and specifying a new timeout value in field stepTimeoutInMinutes) the job execution status will be automatically set to TIMED_OUT. Note that setting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (CreateJob using field timeoutConfig). Valid values for this parameter range from 1 to 10080 (1 minute to 7 days).
        public let stepTimeoutInMinutes: Int64?
        /// The name of the thing associated with the device.
        public let thingName: String

        @inlinable
        public init(statusDetails: [String: String]? = nil, stepTimeoutInMinutes: Int64? = nil, thingName: String) {
            self.statusDetails = statusDetails
            self.stepTimeoutInMinutes = stepTimeoutInMinutes
            self.thingName = thingName
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encodeIfPresent(self.statusDetails, forKey: .statusDetails)
            try container.encodeIfPresent(self.stepTimeoutInMinutes, forKey: .stepTimeoutInMinutes)
            request.encodePath(self.thingName, key: "thingName")
        }

        public func validate(name: String) throws {
            try self.statusDetails?.forEach {
                try validate($0.key, name: "statusDetails.key", parent: name, max: 128)
                try validate($0.key, name: "statusDetails.key", parent: name, min: 1)
                try validate($0.key, name: "statusDetails.key", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
                try validate($0.value, name: "statusDetails[\"\($0.key)\"]", parent: name, min: 1)
                try validate($0.value, name: "statusDetails[\"\($0.key)\"]", parent: name, pattern: "^[^\\p{C}]+$")
            }
            try self.validate(self.thingName, name: "thingName", parent: name, max: 128)
            try self.validate(self.thingName, name: "thingName", parent: name, min: 1)
            try self.validate(self.thingName, name: "thingName", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case statusDetails = "statusDetails"
            case stepTimeoutInMinutes = "stepTimeoutInMinutes"
        }
    }

    public struct StartNextPendingJobExecutionResponse: AWSDecodableShape {
        /// A JobExecution object.
        public let execution: JobExecution?

        @inlinable
        public init(execution: JobExecution? = nil) {
            self.execution = execution
        }

        private enum CodingKeys: String, CodingKey {
            case execution = "execution"
        }
    }

    public struct ThrottlingException: AWSErrorShape {
        /// The message associated with the exception.
        public let message: String?
        /// The payload associated with the exception.
        public let payload: AWSBase64Data?

        @inlinable
        public init(message: String? = nil, payload: AWSBase64Data? = nil) {
            self.message = message
            self.payload = payload
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
            case payload = "payload"
        }
    }

    public struct UpdateJobExecutionRequest: AWSEncodableShape {
        /// Optional. A number that identifies a particular job execution on a particular device.
        public let executionNumber: Int64?
        /// Optional. The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)
        public let expectedVersion: Int64?
        /// Optional. When set to true, the response contains the job document. The default is false.
        public let includeJobDocument: Bool?
        /// Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.
        public let includeJobExecutionState: Bool?
        /// The unique identifier assigned to this job when it was created.
        public let jobId: String
        /// The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.
        public let status: JobExecutionStatus
        ///  Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. The maximum length of the value in the name/value pair is 1,024 characters.
        public let statusDetails: [String: String]?
        /// Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling UpdateJobExecution, setting the status to IN_PROGRESS, and specifying a new timeout value in this field) the job execution status will be automatically set to TIMED_OUT. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (CreateJob using field timeoutConfig). Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of UpdateJobExecutionRequest).
        public let stepTimeoutInMinutes: Int64?
        /// The name of the thing associated with the device.
        public let thingName: String

        @inlinable
        public init(executionNumber: Int64? = nil, expectedVersion: Int64? = nil, includeJobDocument: Bool? = nil, includeJobExecutionState: Bool? = nil, jobId: String, status: JobExecutionStatus, statusDetails: [String: String]? = nil, stepTimeoutInMinutes: Int64? = nil, thingName: String) {
            self.executionNumber = executionNumber
            self.expectedVersion = expectedVersion
            self.includeJobDocument = includeJobDocument
            self.includeJobExecutionState = includeJobExecutionState
            self.jobId = jobId
            self.status = status
            self.statusDetails = statusDetails
            self.stepTimeoutInMinutes = stepTimeoutInMinutes
            self.thingName = thingName
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encodeIfPresent(self.executionNumber, forKey: .executionNumber)
            try container.encodeIfPresent(self.expectedVersion, forKey: .expectedVersion)
            try container.encodeIfPresent(self.includeJobDocument, forKey: .includeJobDocument)
            try container.encodeIfPresent(self.includeJobExecutionState, forKey: .includeJobExecutionState)
            request.encodePath(self.jobId, key: "jobId")
            try container.encode(self.status, forKey: .status)
            try container.encodeIfPresent(self.statusDetails, forKey: .statusDetails)
            try container.encodeIfPresent(self.stepTimeoutInMinutes, forKey: .stepTimeoutInMinutes)
            request.encodePath(self.thingName, key: "thingName")
        }

        public func validate(name: String) throws {
            try self.validate(self.jobId, name: "jobId", parent: name, max: 64)
            try self.validate(self.jobId, name: "jobId", parent: name, min: 1)
            try self.validate(self.jobId, name: "jobId", parent: name, pattern: "^[a-zA-Z0-9_-]+$")
            try self.statusDetails?.forEach {
                try validate($0.key, name: "statusDetails.key", parent: name, max: 128)
                try validate($0.key, name: "statusDetails.key", parent: name, min: 1)
                try validate($0.key, name: "statusDetails.key", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
                try validate($0.value, name: "statusDetails[\"\($0.key)\"]", parent: name, min: 1)
                try validate($0.value, name: "statusDetails[\"\($0.key)\"]", parent: name, pattern: "^[^\\p{C}]+$")
            }
            try self.validate(self.thingName, name: "thingName", parent: name, max: 128)
            try self.validate(self.thingName, name: "thingName", parent: name, min: 1)
            try self.validate(self.thingName, name: "thingName", parent: name, pattern: "^[a-zA-Z0-9:_-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case executionNumber = "executionNumber"
            case expectedVersion = "expectedVersion"
            case includeJobDocument = "includeJobDocument"
            case includeJobExecutionState = "includeJobExecutionState"
            case status = "status"
            case statusDetails = "statusDetails"
            case stepTimeoutInMinutes = "stepTimeoutInMinutes"
        }
    }

    public struct UpdateJobExecutionResponse: AWSDecodableShape {
        /// A JobExecutionState object.
        public let executionState: JobExecutionState?
        /// The contents of the Job Documents.
        public let jobDocument: String?

        @inlinable
        public init(executionState: JobExecutionState? = nil, jobDocument: String? = nil) {
            self.executionState = executionState
            self.jobDocument = jobDocument
        }

        private enum CodingKeys: String, CodingKey {
            case executionState = "executionState"
            case jobDocument = "jobDocument"
        }
    }
}

// MARK: - Errors

/// Error enum for IoTJobsDataPlane
public struct IoTJobsDataPlaneErrorType: AWSErrorType {
    enum Code: String {
        case certificateValidationException = "CertificateValidationException"
        case conflictException = "ConflictException"
        case internalServerException = "InternalServerException"
        case invalidRequestException = "InvalidRequestException"
        case invalidStateTransitionException = "InvalidStateTransitionException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case serviceQuotaExceededException = "ServiceQuotaExceededException"
        case serviceUnavailableException = "ServiceUnavailableException"
        case terminalStateException = "TerminalStateException"
        case throttlingException = "ThrottlingException"
        case validationException = "ValidationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize IoTJobsDataPlane
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// The certificate is invalid.
    public static var certificateValidationException: Self { .init(.certificateValidationException) }
    /// A conflict has occurred when performing the API request.
    public static var conflictException: Self { .init(.conflictException) }
    /// An internal server error occurred when performing the API request.
    public static var internalServerException: Self { .init(.internalServerException) }
    /// The contents of the request were invalid.
    public static var invalidRequestException: Self { .init(.invalidRequestException) }
    /// An update attempted to change the job execution to a state that is invalid because of the job execution's current state (for example, an attempt to change a request in state SUCCESS to state IN_PROGRESS). In this case, the body of the error message also contains the executionState field.
    public static var invalidStateTransitionException: Self { .init(.invalidStateTransitionException) }
    /// The specified resource does not exist.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// The service quota has been exceeded for this request.
    public static var serviceQuotaExceededException: Self { .init(.serviceQuotaExceededException) }
    /// The service is temporarily unavailable.
    public static var serviceUnavailableException: Self { .init(.serviceUnavailableException) }
    /// The job is in a terminal state.
    public static var terminalStateException: Self { .init(.terminalStateException) }
    /// The rate exceeds the limit.
    public static var throttlingException: Self { .init(.throttlingException) }
    /// A validation error occurred when performing the API request.
    public static var validationException: Self { .init(.validationException) }
}

extension IoTJobsDataPlaneErrorType: AWSServiceErrorType {
    public static let errorCodeMap: [String: AWSErrorShape.Type] = [
        "ConflictException": IoTJobsDataPlane.ConflictException.self,
        "ThrottlingException": IoTJobsDataPlane.ThrottlingException.self
    ]
}

extension IoTJobsDataPlaneErrorType: Equatable {
    public static func == (lhs: IoTJobsDataPlaneErrorType, rhs: IoTJobsDataPlaneErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension IoTJobsDataPlaneErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
